import {Route} from "react-router-dom";
import Index from "./index/index";
import Person from "../person";
import React from "react";
/**
 * @Description:
 * @author 云离
 * @date: 2020-02-06
 */
const UserMng = React.lazy(() => import('./system/userMng'));
const ExchangeRate = React.lazy(() => import('./system/exchangeRate'));
const UserInfoAgent = React.lazy(() => import('./system/UserInfo/daili'));
const Business = React.lazy(() => import('./system/UserInfo/index'));
const ChannelOrder = React.lazy(() => import('./order/channelOrder/index'));
const GoogleCheck =  React.lazy(() => import('./account/googleCheck/index'));
const CashChange = React.lazy(() => import('./cash/cashChange/index'));
const CashRecord =  React.lazy(() => import('./cash/cashRecord/index'))
const BusinessDayChart =  React.lazy(() => import( './charts/businessDayChart/index'))
const BusinessSummary =  React.lazy(() => import( './charts/businessSummary/index'))
const AgentDayChart =  React.lazy(() => import( './charts/agentDayChart/index'))
const AgentSummary =  React.lazy(() => import( './charts/agentSummary/index'))
const CardMng =  React.lazy(() => import(  './account/carkMng/index'))
const PayPw =  React.lazy(() => import('./account/payPw'))
const BusinessInfo =  React.lazy(() => import('./account/businessInfo/index'))
const SettlementApply =  React.lazy(() => import( './cash/settlementApply/index'))
const AccountGroup =  React.lazy(() => import( './order/accountGroup/index'))
const ChannelAccount = React.lazy(() => import( './order/channelAccount/index'))
const SubAccount = React.lazy(() => import( './order/subAccount/index'))
const ChannelPaytypeChart = React.lazy(() => import( './charts/channelPayTypeChart/index'))
const ChannelDayChart = React.lazy(() => import( './charts/channelDayChart/index'))
const ChannelHoureChart = React.lazy(() => import( './charts/channelHoureChart/index'))
const ChannelBusinessDayChart = React.lazy(() => import( './charts/channelBusinessDayChart/index'))
const ChannelAgentDayChart = React.lazy(() => import( './charts/channelAgentDayChart/index'))
const SystemConfig = React.lazy(() => import( './system/config'))
const routeConfig = [{
    sourcePath: '/index',
    redirect: '/main/',
    title: '首页',
    render: <Route exact path="/main/" component={Index}/>
}, {
    sourcePath: '',
    redirect: '/main/person',
    title: '个人中心',
    render: <Route path="/main/person" component={Person}/>
}, {
    sourcePath: '/system/user',
    redirect: '/main/userMng',
    title: '用户管理',
    render: <Route exact path="/main/userMng" component={UserMng}/>
}, {
    sourcePath: '/system/config',
    redirect: '/main/config',
    title: '配置管理',
    render: <Route path="/main/config" component={SystemConfig}/>
}, {
    sourcePath: '',
    redirect: '/main/exchangeRate/:userId',
    title: '商户费率',
    render: <Route path="/main/exchangeRate/:userId" component={ExchangeRate}/>
}, {
    sourcePath: '',
    redirect: '/main/userMng/userInfo/agent/:userId',
    title: '代理商信息',
    render: <Route path="/main/userMng/userInfo/agent/:userId" component={UserInfoAgent}/>
}, {
    sourcePath: '',
    redirect: '/main/userMng/userInfo/business/:userId',
    title: '商户信息',
    render: <Route path="/main/userMng/userInfo/business/:userId" component={Business}/>,
}, {
    sourcePath: '/channel/channelOrder',
    redirect: '/main/channelOrder',
    title: '通道订单',
    render: <Route path="/main/channelOrder" component={ChannelOrder}/>
}, {
    sourcePath: '/system/user/bindGoogle',
    redirect: '/main/googleCheck',
    title: '谷歌验证',
    render: <Route path="/main/googleCheck" component={GoogleCheck}/>
}, {
    sourcePath: '/channel/businessCashChange',
    redirect: '/main/cashChange',
    title: '资金变动',
    render: <Route path="/main/cashChange" component={CashChange}/>,
}, {
    sourcePath: '/channel/businessCapital',
    redirect: '/main/cashRecord',
    title: '提现记录',
    render: <Route path="/main/cashRecord" component={CashRecord}/>,
}, {
    sourcePath: '/channel/vwBusinessCashDayStat',
    redirect: '/main/businessDayChart',
    title: '商户日报表',
    render: <Route path="/main/businessDayChart" component={BusinessDayChart}/>
}, {
    sourcePath: '/channel/vwBusinessCashStat',
    redirect: '/main/businessSummary',
    title: '商户汇总',
    render: <Route path="/main/businessSummary" component={BusinessSummary}/>
}, {
    sourcePath: '/channel/vwAgentCashStat',
    redirect: '/main/agentSummary',
    title: '代理商汇总',
    render: <Route path="/main/agentSummary" component={AgentSummary}/>
}, {
    sourcePath: '/channel/vwAgentCashDayStat',
    redirect: '/main/agentDayChart',
    title: '代理商日报表',
    render: <Route path="/main/agentDayChart" component={AgentDayChart}/>
}, {
    sourcePath: '/channel/bankInfo',
    redirect: '/main/cardMng',
    title: '银行卡',
    render: <Route path="/main/cardMng" component={CardMng}/>
}, {
    sourcePath: '/channel/businessInfo/resetBusinessPayPwd',
    redirect: '/main/paySet',
    title: '支付密码',
    render: <Route path="/main/paySet" component={PayPw}/>,
}, {
    sourcePath: '/channel/businessInfo/info',
    redirect: '/main/businessInfo',
    title: '商户信息',
    render: <Route path="/main/businessInfo" component={BusinessInfo}/>
}, {
    sourcePath: '/channel/businessCapital/add1',
    redirect: '/main/settlementApply',
    title: '结算申请',
    render: <Route path="/main/settlementApply" component={SettlementApply}/>
}, {
    sourcePath: '/channel/channelAccountGroup',
    redirect: '/main/accountGroup',
    title: '账号分组',
    render: <Route path="/main/accountGroup" component={AccountGroup}/>
}, {
    sourcePath: '/channel/channelAccount',
    redirect: '/main/channelAccount',
    title: '通道账户',
    render: <Route exact path="/main/channelAccount" component={ChannelAccount}/>
}, {
    sourcePath: '',
    redirect: '/main/channelAccount/subAccount/:accountId',
    title: '子账户',
    render: <Route path="/main/channelAccount/subAccount/:accountId" component={SubAccount}/>
}, {
    sourcePath: '/channel/vwChannelPayTypeDayStat',
    redirect: '/main/channelPayTypeChart',
    title: '码商代理支付类型报表',
    render: <Route path="/main/channelPayTypeChart" component={ChannelPaytypeChart}/>
}, {
    sourcePath: '/channel/vwChannelQrCashDayStat',
    redirect: '/main/channelDayChart',
    title: '码商日报表',
    render: <Route path="/main/channelDayChart" component={ChannelDayChart}/>
}, {
    sourcePath: '/channel/vwChannelQrCashHourStat',
    redirect: '/main/channelHoureChart',
    title: '码商小时成功率',
    render: <Route path="/main/channelHoureChart" component={ChannelHoureChart}/>
}, {
    sourcePath: '/channel/vwChannelBusinessCashDayStat',
    redirect: '/main/channelBusinessDayChart',
    title: '码商代理商户日报表',
    render: <Route path="/main/channelBusinessDayChart" component={ChannelBusinessDayChart}/>
}, {
    sourcePath: '/channel/vwChannelCashDayStat',
    redirect: '/main/channelAgentDayChart',
    title: '码商代理日报表',
    render: <Route path="/main/channelAgentDayChart" component={ChannelAgentDayChart}/>
}]

const titleMap = {}
const urlMapCatch = {}
routeConfig.forEach(item => {
    titleMap[item.redirect] = item.title
    urlMapCatch[item.sourcePath] = item.redirect
})

//  不进行显示的菜单
export const ignoreMenu = [
    '/channel/channelCode',
    '/channel/channelAccountAmount',
    '/channel/channelOrder/red',
    '/channel/channelOrder/eorder',
    '/channel/channelUserInfo/resetChannelSendPwd'
]

export const urlMap = urlMapCatch


export const TitleMap = titleMap
const routes = routeConfig.map(item => item.render)
export default routes
